package com.ruoyi.bloom;

import com.google.common.hash.BloomFilter;
import com.google.common.hash.Funnels;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class BloomFilterConfig {

    @Bean
    public BloomFilter<Long> idBloomFilter() {
        // 预期插入100万条数据，误判率1%
        return BloomFilter.create(
                Funnels.longFunnel(),
                1_000_000,
                0.01
        );
    }
}
